home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / utility / wzun11sr.zip / WIZUNZIP.H < prev    next >
C/C++ Source or Header  |  1992-04-09  |  8KB  |  244 lines

  1. /* Main include file for  Windows Unzip: unzip.h
  2.  * This include file is copied into all `C' source modules specific to 
  3.  * Windows Info-ZIP Unzip.
  4.  * Author: Robert A. Heath, 157 Chartwell Rd., Columbia, SC 29210
  5.  * I, Robert A. Heath, place this module, wizunzip.h, in the public domain.
  6.  */
  7.  
  8. /* These two are dependent on zip directory listing format string.
  9.  * They help find the filename in the listbox entry.
  10.  */
  11. #define SHORT_FORM_FNAME_INX    27
  12. #define LONG_FORM_FNAME_INX    58
  13.  
  14. #define MIN_SHORT_FORMAT_CHARS (SHORT_FORM_FNAME_INX+12)
  15. #define MIN_LONG_FORMAT_CHARS (LONG_FORM_FNAME_INX+12)
  16.  
  17. #define MAX_DIRNAME_LEN 80
  18.  
  19. /* Arbitrary Constants
  20.  */
  21. #define STATUS_ROWS 6            /* typical no. status box rows        */
  22. #define BG_SYS_COLOR COLOR_GRAYTEXT /* background color is a system color */
  23.  
  24. /* Main window menu item positions
  25.  */
  26. #define HELP_MENUITEM_POS        5    /* the Help menu                */
  27.  
  28. /* Main Window Message Codes
  29.  */
  30.  
  31. #define IDM_OPEN            101
  32. #define IDM_EXIT            102
  33.  
  34. #define IDM_SHORT            104
  35. #define IDM_LONG            105
  36.  
  37.  
  38. #define    IDM_HELP            106
  39. #define    IDM_ABOUT            107
  40.  
  41. #define IDM_RECR_DIR_STRUCT 108
  42. #define IDM_OVERWRITE        109
  43. #define IDM_TRANSLATE        110
  44. #define IDM_UNZIP_TO_ZIP_DIR 111
  45.  
  46. #define IDM_EDIT               112
  47. #define IDM_PATH             113
  48.  
  49.  
  50. #define IDM_HEADER_LINE1            115
  51. #define IDM_HEADER_LINE2            116
  52. #define IDM_COMMENT            117
  53. #define IDM_TOTAL_LINE1        118
  54. #define IDM_TOTAL_LINE2        119
  55.  
  56. #define IDM_SELECT_ALL        120
  57.  
  58. /* These six items are the tab-stop windows whose ID's must be kept
  59.  * in order.
  60.  */
  61. #define IDM_LISTBOX          121
  62. #define IDM_EXTRACT            122
  63. #define IDM_DISPLAY            123
  64. #define    IDM_TEST            124
  65. #define IDM_SHOW_COMMENT    125
  66. #define IDM_STATUS            126
  67. #define TABSTOP_ID_BASE IDM_LISTBOX
  68.  
  69. #define IDM_MAX_STATUS        127
  70. #define IDM_RESTORE_STATUS    128
  71.  
  72. #define IDM_LB_EXTRACT        135
  73. #define IDM_LB_DISPLAY        136
  74. #define IDM_LB_TEST            137
  75. #define IDM_DESELECT_ALL    138
  76. #define IDM_CLEAR_STATUS    139
  77. #define IDM_HELP_KEYBOARD    140
  78. #define IDM_HELP_HELP        141
  79. #define IDM_CHDIR            142
  80.  
  81.  
  82. /* Help Window Menu and Message ID's
  83.  */
  84. #define INDEX_MENU_ITEM_POS 0
  85.  
  86. #define IDM_FORWARD 100
  87. #define IDM_BACKWARD 101 
  88.  
  89.  
  90. /* Tab-stop table is used to sub-class those main window items to
  91.  * which the tab and back-tab keys will tab and stop.
  92.  */
  93. typedef struct TabStop_tag {
  94.     FARPROC lpfnOldFunc;        /* original function                */
  95.     HWND hWnd ;            
  96. } TabStopEntry;
  97.  
  98. typedef TabStopEntry *PTABSTOPENTRY;
  99. #define TABSTOP_TABLE_ENTRIES 6
  100.  
  101. #define MAKE_TABSTOP_TABLE_ENTRY(WNDHANDLE, ID) \
  102.     { \
  103.         TabStopTable[ID - TABSTOP_ID_BASE].lpfnOldFunc = \
  104.             (FARPROC)GetWindowLong(WNDHANDLE, GWL_WNDPROC); \
  105.         SetWindowLong(WNDHANDLE, GWL_WNDPROC, (LONG)lpfnKbdProc); \
  106.         TabStopTable[ID - TABSTOP_ID_BASE].hWnd = WNDHANDLE; \
  107.     }
  108.  
  109. #ifndef NDEBUG
  110. #define WinAssert(exp) \
  111.         {\
  112.         if (!(exp))\
  113.             {\
  114.             char szBuffer[40];\
  115.             sprintf(szBuffer, "File %s, Line %d",\
  116.                     __FILE__, __LINE__) ;\
  117.             if (IDABORT == MessageBox(NULL, szBuffer,\
  118.                 "Assertion Error",\
  119.                 MB_ABORTRETRYIGNORE|MB_ICONSTOP))\
  120.                     FatalExit(-1);\
  121.             }\
  122.         }
  123.  
  124. #else
  125.  
  126. #define WinAssert(exp)
  127.  
  128. #endif
  129.  
  130.         
  131. extern TabStopEntry TabStopTable[]; /* tab-stop control table            */
  132.  
  133. extern BOOL bStatusMaxed ;    /* status box is maximized when true        */
  134. extern WORD wHelpItem;            /* item to pass to Help proc            */
  135. extern short xchar, ychar;    /* size of char in SYSTEM font in pixels    */
  136.  
  137. extern HANDLE hFixedFont;
  138.  
  139. extern HWND hWndComment;        /* comment window                        */
  140.  
  141. extern HWND    hWndHeaderLine1;     /* header line 1                        */
  142. extern HWND    hWndHeaderLine2;     /* header line 2                        */
  143.  
  144. extern HWND    hWndTotalLine1;     /* total line 1                        */
  145. extern HWND    hWndTotalLine2;     /* total line 2                        */
  146.  
  147. extern HWND hWndList;        /* listbox handle                        */
  148.  
  149. extern HWND    hMainWnd;         /* the main window handle.         */
  150.  
  151. extern HWND hExtract;            /* extract button                */
  152. extern HWND hDisplay;            /*display button                */
  153. extern HWND hTest;                /* test button                    */
  154. extern HWND hShowComment;        /* show comment button            */
  155. extern HANDLE hInst;                       /* current instance                      */
  156. extern HMENU  hMenu;                /* main menu handle            */
  157. extern HANDLE hAccTable;
  158.  
  159. extern HANDLE hHourGlass;              /* handle to hourglass cursor         */
  160. extern HANDLE hSaveCursor;              /* current cursor handle         */
  161. extern HANDLE hHelpCursor;            /* help cursor                */
  162. extern HANDLE hFixedFont;            /* handle to fixed font                */
  163. extern HANDLE hOldFont;            /* handle to old font                */
  164.  
  165. extern int hFile;                  /* file handle             */
  166. extern int    MsWinDoAll;                /* referenced in file_io.c        */
  167. extern HWND hHelpWnd;                /* Help Window handle                    */
  168. extern HWND    hWndList;              /* list box handle        */
  169. extern HWND hWndStatus;        /* status    */
  170. extern HWND hDlgAbout;                /* handle to about box                */
  171.  
  172. extern BOOL bHelp;            /* help key has been hit when TRUE            */
  173. extern BOOL bRealTimeMsgUpdate; /* update messages window in real-time */
  174. extern BOOL bRecreateDirs;    /* re-create directory structures when TRUE */
  175. extern BOOL bTranslate;    /* translate LF to CR-LF                    */
  176. extern WORD wFormat;        /* display format: 0 = short, 1 = long */
  177. extern BOOL bOverwrite;        /* overwrite files: IDM_PROMPT, IDM_OVERWRITE */
  178. extern BOOL bUnzipToZipDir;    /* unzip to .ZIP dir; else keep separate */
  179. extern WORD wLBSelection;    /* default listbox selection action */
  180. extern HWND hDlgHelp;                    /* Help dialog handler         */
  181.  
  182. extern FARPROC  lpHelpDlg;        /* Help Dialog proc instance        */
  183.  
  184. extern HBRUSH hBrush ;            /* brush for  standard window backgrounds  */
  185.  
  186. extern char szAppName[];        /* application name                */
  187. extern char szFileName[];        /* current file name in ANSI        */
  188. extern char szDirName[];          /* resultant Directory Name        */
  189. extern char szOrigDirName[];    /* original directory name        */
  190. extern char szStatusClass[];    /* status class name                */
  191. extern char *Headers[][2] ;        /* headers to display            */
  192. extern char FORMAT_KEY[];        /* Format WIN.INI keyword        */
  193. extern char OVERWRITE_KEY[];    /* Overwrite WIN.INI keyword        */
  194. extern char TRANSLATE_KEY[];    /* Translate WIN.INI keyword        */
  195. extern char LBSELECTION_KEY[];    /* LBSelection keyword in WIN.INI */
  196. extern char RECREATE_DIRS_KEY[]; /* re-create directory structure 
  197.                                     WIN.INI keyword             */
  198. extern char UNZIP_TO_ZIP_DIR_KEY[];   /* unzip to .ZIP dir WIN.INI keyword */
  199.  
  200. extern char *LBSelectionTable[];
  201. extern char NoMemoryMsg[] ;        /* error message            */
  202. extern WORD wCommentLength ;    /* length of comment in .ZIP file    */
  203.  
  204. /* List box stuff
  205.  */
  206. extern WORD    TotalZippedFiles;        /* total personal records in file    */
  207. extern WORD ListBoxLines; /* max list box lines showing on screen */
  208. extern WORD MessageWinLines; /* max visible lines on message window  */
  209.  
  210. void DoCaption(HWND hWnd, PSTR szFileName);
  211. int DoFileOpenDlg(HANDLE hInst, HWND hWnd, PSTR szFileSpecIn, PSTR szDefExtIn, 
  212.                 WORD wFileAttrIn, PSTR szFileNameOut, POFSTRUCT pofIn);
  213.  
  214.  
  215. /* some global functions
  216.  */
  217. void Action(WORD wActionCode);
  218. int unzipmain(int argc, char *argv[]);
  219. void DisplayComment(void);
  220. int GetLBSelCount(HWND hListBox, int **ppnSelItems);
  221. void IndexHelp(HWND hWnd, HMENU hMenu, PSTR HelpFile);    /* index help file    */
  222. void ReselectLB(HWND hListBox, int nSelCount, int *pnSelItems);
  223. BOOL SetUpToProcessZipFile(int ncflag, int ntflag, int nvflag, int nUflag, 
  224.                             int nzflag, int ndflag, int noflag, int naflag,
  225.                             int argc, PSTR psZipFN, PSTR *FNV);
  226. void TakeDownFromProcessZipFile(void);
  227. void SizeWindow(HWND hWnd, BOOL bOKtoMovehWnd);
  228. void UpdateButtons(HWND hWnd);
  229. void UpdateListBox(HWND hWnd);
  230. void UpdateMsgWndPos(void);
  231. BOOL WizUnzipInit(HANDLE hInst);
  232. void WriteBufferToMsgWin(LPSTR buffer, int nBufferLen, BOOL bUpdate);
  233. void WriteStringToMsgWin(PSTR String, BOOL bUpdate);
  234.  
  235. /* Far Proc's
  236.  */
  237. BOOL FAR PASCAL About(HWND hDlg, WORD message, WORD wParam, LONG lParam);
  238. BOOL FAR PASCAL ChDirProc(HWND hDlg, WORD message, WORD wParam, LONG lParam);
  239. BOOL FAR PASCAL FileDlgProc(HWND hDlg, WORD message, WORD wParam, LONG lParam);
  240. long FAR PASCAL HelpWndProc (HWND hWnd, unsigned iMessage, WORD wParam, LONG lParam); 
  241. long FAR PASCAL KbdProc(HWND hWnd, WORD message, WORD wParam, LONG lparam);
  242. BOOL FAR PASCAL Replace(HWND hDlg, WORD message, WORD wParam, LONG lParam);
  243. long FAR PASCAL StatusProc (HWND hWnd, unsigned iMessage, WORD wParam, LONG lParam); 
  244.